home *** CD-ROM | disk | FTP | other *** search
- ------------------------------------------------------------------------
-
- SD: MS-DOS Sorted Directory Utility Program
-
- Version 5.3 (C) 14-Oct-86 by John F. Stetson
-
- ------------------------------------------------------------------------
-
- Introduction
-
- ------------------------------------------------------------------------
-
- SD.COM is a sorted directory utility program which operates under the
- Microsoft Disk Operating System Version 2 and above. There are two
- different versions of the program tailored for either the Zenith Z-100
- series computers or IBM-PC compatible computers.
-
- SD provides more information than the MS-DOS resident DIR command about
- the files on a disk, and allows the user to select, sort, format, and
- display the information in a variety of ways.
-
- The program defaults to using the BIOS (rather than DOS) for console
- output, which results in noticeably faster displays. Command output can
- still be redirected to an output file by using a special switch.
-
- Maximum possible use is made of the horizontal dimension of the screen
- to minimize the loss of previously displayed data by screen scrolling.
-
- Support is provided for a variety of screen display formats with varying
- amounts of detailed file information displayed.
-
- A variety of user customizable command line switches and screen field
- display colors are also supported.
-
- Every effort has been made to keep the size of the program to a minimum,
- for efficient use on floppy disk based systems. However, many of the
- capabilities of both MS-DOS and this program are only fully realized
- when using large hard (fixed) disks with hierarchical directory
- structures to organize files.
-
- ------------------------------------------------------------------------
-
- Command Line Syntax
-
- ------------------------------------------------------------------------
-
- The complete form of the DOS command line to run the program is:
-
- D>sd [drive:][path][filespec] [/switches] [>[>]device/file]
-
- In most cases, only one or two parameters are specified, so the command
- syntax isn't as formidable as it may appear at first. Each of the
- command line parameters is optional (as the [] characters indicate) and
- may be used together in any combination or order. Spaces may also be
- freely used at any point to improve readability. The various command
- line parameters are described below:
-
- [drive:]
-
- This parameter specifies the name of the disk drive to be processed.
- Typical drive letters are A: or B: for floppy disks and C: for a hard
- disk on the IBM-PC/XT or E: on the Zenith Z-100. RAM (memory) disks
- installed as device drivers may also be specified, and typically have
- the highest drive letter currently in use by the system assigned to
- them. If no drive letter is specified, the currently logged-in drive
- (shown in the DOS prompt) is used.
-
- [path]
-
- This parameter specifies the path through the hierarchical directory
- structure to the desired directory which contains the files to be
- processed. The general form of the path parameter is shown below:
-
- [path] = [\][directory][\directory]...[\directory][\]
-
- The path name may simply be the name of the root directory (\), or the
- same of a subdirectory in the root directory. The standard DOS . and ..
- directory names may be used to refer to the current and parent
- directories, respectively. If a path is not specified, the current
- directory on the specified disk drive is used.
-
- [filespec]
-
- This parameter specifies which file names are to be selected for
- processing from the previously specified directory (if any). A complete
- (unambiguous) file name may be specified, or an ambiguous file name,
- containing 'wildcard' characters (? or *) may be specified to select
- several files. Either the file name (first 8 characters) or the file
- extension (last 3 characters) or both may be completely omitted. In
- these cases, wildcard characters are automatically used to match all
- possible file names in the selected directory. You may specify leading
- characters of the file names you wish to match, omitting the trailing
- characters of the name, the period delimiter, and the file extension. In
- this respect, SD processes file specifications differently than DIR.
-
- [/switches]
-
- This parameter specifies one or more 'switch' or option values which
- modify the operation of the command. All switches are optional and may
- be specified before the drive, path, and filespec, after them, or both
- before and after. An almost infinite variety of different processing
- modes may be selected by combining the various switches together in
- different combinations. Each switch has a default value, which has been
- carefully selected to represent the most frequently used option, for
- most users. Specifying a switch overrides or 'toggles' the value of
- that command option. A special 'patch' area has been provided at the
- beginning of the SD.COM file so that sophisticated users can tailor the
- default switch settings to their needs. If a default switch value is
- modified, specification of that option will toggle the option back to
- its original state, if appropriate. Detailed descriptions of all
- switches are given below.
-
- [>[>]device/file]
-
- This parameter is actually a standard feature of DOS called redirection
- of output to the 'standard output' (stdout) device. This allows the
- console output generated by the program to be transmitted to either
- another device (usually the printer device (PRN)), or to a disk file. By
- redirecting the output of the command to a file, you can later use the
- file as input to a word processor, disk catalog system, etc. If this
- parameter is specified, the /r switch must also be specified so that the
- program will know to use the standard DOS console output services
- instead of those in the BIOS, which cannot be redirected.
-
- ------------------------------------------------------------------------
-
- Command Line Switches
-
- ------------------------------------------------------------------------
-
- If a switch value other than those described below is specified, such as
- /h or /x, the console screen is cleared and a summary of the command
- line syntax information is displayed.
-
-
- File Selection
-
- These switches are used to further restrict which files are selected
- (in addition to any filespec) based on the attributes of the files.
-
- If a /s switch is not specified, the default is to select all of the
- subdirectories and files in the specified directory, except those with
- either the system or hidden attribute.
-
- /s - Select all directories and files including system and hidden
- /sd - Select only directories (no files)
- /sa - Select only files with the archive attribute
- /sr - Select only files with the read-only attribute
- /sh - Select only files with the hidden attribute
- /ss - Select only files with the system attribute
-
- File selection switches may either be specified separately or together:
-
- D>sd e:\dir/sa/sr - or - D>sd e:\dir/sar
-
- When multiple /s switches are specified, the effect is 'additive'; i.e.
- for the example above all files with either the archive or read-only
- attribute will be selected from the specified directory.
-
-
- Sort Fields
-
- These switches specify which fields are to be used as sort 'keys' when
- formatting the output information. These switches are all mutually
- exclusive; i.e. only one sort switch should be specified. If no sort
- switches are specified, the /f switch is the default.
-
- /f - Ascending sort by (1) file name and (2) extension
- /e - Ascending sort by (1) file extension and (2) name
-
- /b - Ascending sort by file sizes in bytes (smallest first)
-
- /d - Descending sort by (1) file date and (2) time (newest first)
- /a - Ascending sort by (1) file date and (2) time (oldest first)
-
- /n - No sort - display entries in directory order
-
-
- Output Control
-
- These switches are used to specify the appearance and format of the
- generated output and other miscellaneous functions. The switches fall
- into two categories and are described separately.
-
- The first group of output switches selects the number of output columns.
- A larger number of columns allows more files to be displayed on the
- console screen at one time, at the cost of losing some of the detailed
- file information. A smaller number of columns allows more detailed file
- information to be displayed, at the cost of only being able to display a
- limited number of files. All of these switches are mutually exclusive;
- only one should be specified. The default switch is /4.
-
- /1 - 1 output column - path, file name, size, date, time, attributes
- /2 - 2 output columns - file name, size, date and time
- /4 - 4 output columns - file name and size
- /6 - 6 output columns - file names only
-
- If the /1 switch is specified, the output information begins with the
- specified path name. This can be useful when used as input to a disk
- catalog program. The output ends with file attribute information. Each
- file attribute (if any) is denoted by a letter:
-
- A - Archive R - Read-Only H - Hidden S - System
-
- The archive attribute is turned on when a file is written to and is
- turned off by the BACKUP program when the file is backed up.
-
- The time a file was last written to is only accurate to a resolution of
- 2 seconds; all values will have an even number of seconds. Files
- created with early versions of DOS may not have either a date or time
- stamp. In this case, these fields will appear as periods.
-
- Subdirectory entries (normally found in the root directory) are shown in
- reverse video for emphasis. This is especially helpful when using the
- /6 switch, since there isn't room for the <Dir> indicator (subdirectory
- names may be up to 11 characters in length, just like ordinary files).
-
- The next group of switches are all 'toggles'; i.e. their default state
- is 'off' and they are toggled 'on' when specified. These may be used
- together in all possible combinations.
-
- /c - Clear the console screen before displaying output
- /q - Quick output (no pause when the console screen fills)
- /r - Generate output which is suitable for redirection
-
- /m - Display system version number and RAM information
- /v - Display disk volume label and creation date & time
- /p - Display disk parameter information
- /k - Display RAM and disk space values in rounded kbytes
- /t - Display only the trailing totals summary lines
-
- Console output may be paused by typing any character and is restarted
- when another character is typed. If /q (or /r) is not specified, output
- is paused every time the screen fills. Typing Control-Break or Control-C
- will terminate the program prematurely.
-
- If it is desired to redirect console output to a file or to the printer,
- the /r switch must be specified to tell the program to use the DOS
- console output services. This applies to both the command line
- redirection symbol (>) and to the Control-P printer echo function. The
- program normally displays a graphics vertical bar symbol to separate
- adjacent columns of output information. This is changed to the standard
- ASCII (|) character if redirection is requested. Specification of the
- /r switch causes the /q switch to be turned on automatically.
-
- The /m switch requests that the following DOS system information be
- displayed: DOS Version Number, System RAM Used, RAM Free, and the Total
- Available RAM.
-
- The /v switch causes the disk volume label (if any), and the volume
- creation date and time to be displayed. In addition, the current day of
- the week, date, and time are displayed.
-
- If the /p switch is specified, the following disk parameter values are
- displayed: FAT Media Byte, Bytes/Sector, Bytes/Cluster, Total Clusters.
-
- The /k switch requests that system RAM and disk space information be
- displayed in units of kilobytes (1024 bytes), rather than the default
- units of bytes. In addition, these values are rounded upward, taking
- into account the allocation unit (cluster) size for the specified disk.
- System RAM values are simply rounded to the next higher kilobyte.
- Typical values of cluster sizes for standard disk types are shown below:
-
- Disk Type Capacity Cluster Size
- --------- -------- ------------
- SS 48 TPI 8 Sectors/Track 160k 512
- SS 48 TPI 9 Sectors/Track 180k 512
- DS 48 TPI 8 Sectors/Track 320k 1024
- DS 48 TPI 9 Sectors/Track 360k 1024
- DS 96 TPI 8 Sectors/Track 640k 2048
- DS 96 TPI 9 Sectors/Track 720k 2048
- Winchester (Hard) Disk 10m 4096
- Winchester (Hard) Disk 20m 8192
-
- Most DOS disks use 512 bytes per sector, and with the 12 bit File
- Allocation Table entries prior to DOS V3 (4096 clusters), this requires
- that progressively greater cluster sizes be used to support larger
- storage devices. This can result in a substantial amount of wasted
- space for large capacity hard disks with many relatively small files.
- DOS V3 added support for 16 bit FAT entries which allows 65536 clusters
- to be used, thus allowing a much smaller cluster size to be used with a
- corresponding better utilization of disk space. For disks with a
- cluster size less than 1024 bytes, the /k switch causes the file sizes
- and disk space values to be displayed in bytes, but rounded up to the
- cluster size, since using units of kbytes would be somewhat inaccurate.
-
- The /t switch requests that only the trailing totals summary lines be
- displayed. This option is useful when you wish to compare the total
- number or sizes of files on two different disks or directories. If a
- difference is detected, other switches (such as /b or /d) can be used to
- determine which files are missing.
-
-
- Modifying the Default Switch Values
-
- The default switch values may be altered by using DEBUG.COM to modify
- the following bytes at the beginning of the SD.COM file:
-
- Offset Switch Default Possible Value(s)
- ------ ------ ------- -----------------
- 0102 Sort 'F' 'A', 'B', 'D', 'E', 'F', 'N'
- 0103 Cols '4' '1', '2', '4', '6'
- 0104 /c 0 0, 1=Clear console screen
- 0105 /k 0 0, 1=Display space in kbytes
- 0106 /m 0 0, 1=Display system RAM usage
- 0107 /p 0 0, 1=Display disk parameters
- 0108 /q 0 0, 1=Quick output (no pauses)
- 0109 /r 0 0, 1=Allow output redirection
- 010A /t 0 0, 1=Totals output lines only
- 010B /v 0 0, 1=Volume label information
-
- Example:
-
- D>DEBUG SD.COM (load SD.COM into memory using DEBUG.COM)
- -E103 '2' (Change the default number of columns to 2)
- -E10B 01 (Display the volume label info as a default)
- -W (Write the modified file back to disk)
- -Q (Exit to DOS from DEBUG)
- D>sd (Execute the modified version of SD.COM)
-
- ------------------------------------------------------------------------
-
- Screen Color Selection
-
- ------------------------------------------------------------------------
-
- The default foreground and background colors (screen attributes) used
- for the following fields of the displayed output may be patched:
-
- 1) File Colors - apply to individual disk file entries.
-
- 2) Directory Colors - apply to individual directory entries.
-
- 3) Separator Colors - apply to the separator characters which are used
- to divide the entry columns vertically.
-
- 4) Text Colors - apply to the leading and trailing text lines.
-
- 5) Normal Colors - apply to the normal state of the screen before and
- after SD.COM is executed. These colors should be changed to
- match the standard screen colors used, if they are other than
- white on black.
-
-
- For the Z-100:
-
- Offset Field Color Def.(Color) Def.(Mono)
- ------ ----------- ----------- ----------
- 010C File Fore Color '7' White '7' White
- 010D File Back Color '1' Blue '0' Black
- 010E Directory Fore Color '0' Black '0' Black
- 010F Directory Back Color '4' Green '4' Green
- 0110 Separator Fore Color '2' Red '7' White
- 0111 Separator Back Color '0' Black '0' Black
- 0112 Text Fore Color '6' Yellow '7' White
- 0113 Text Back Color '0' Black '0' Black
- 0114 Normal Fore Color '7' White '7' White
- 0115 Normal Back Color '0' Black '0' Black
-
- '0' = Black, '1' = Blue, '2' = Red, '3' = Magenta
- '4' = Green, '5' = Cyan, '6' = Yellow, '7' = White
-
- Two different sets of default colors are shown in the table above for
- color and monochrome monitors. As supplied, the Z-100 version of SD.COM
- is configured for a color monitor. For proper operation on the Z-100,
- an ALTCHAR.SYS file must exist in the root directory of the boot disk,
- and the file must contain the standard Z-100 graphics font symbols
- (or the graphics vertical bar separator will appear as a grave accent).
-
-
- For the IBM-PC:
-
- Offset Field Attribute Default Description
- ------ --------------- ------- -----------
- 010C File Fore/Back Colors 7+16*1 White on Blue
- 010D Directory Fore/Back Colors 0+16*2 Black on Green
- 010E Separator Fore/Back Colors 4+16*0 Red on Black
- 010F Text Fore/Back Colors 6+16*0 Brown on Black
- 0110 Normal Fore/Back Colors 7+16*0 White on Black
-
- 0111 File Mono Attributes 7+16*0 Normal Video
- 0112 Directory Mono Attributes 0+16*7 Reverse Video
- 0113 Separator Mono Attributes 7+16*0 Normal Video
- 0114 Text Mono Attributes 7+16*0 Normal Video
- 0115 Normal Mono Attributes 7+16*0 Normal Video
-
- 0 = Black, 1 = Blue, 2 = Green, 3 = Cyan
- 4 = Red, 5 = Magenta, 6 = Brown, 7 = White
-
- The PC version of SD.COM uses either the color or monochrome attributes
- specified at the offsets in the table above, based on the type of
- monitor being used.
-
- Once the desired foreground and background colors (attributes) have been
- selected for an output field, compute the field attribute byte using the
- formula: attribute = fcolor+16*bcolor, where fcolor and bcolor are the
- foreground and background colors (attributes), respectively.
-
- Intensified foreground colors corresponding to the 8 standard colors may
- be selected by adding 8 to the foreground color number. For example,
- specify foreground color 14=(6+8) to get a foreground yellow color
- instead of the unintensified brown. The blinking attribute may be
- selected by adding 8 to the background color number. However, use of
- this attribute is not recommended, since it may be distracting. For a
- monochrome monitor, selecting Blue on Black (1+16*0) will cause the
- output field to be underlined.
-
- ------------------------------------------------------------------------
-
- Examples of Use
-
- ------------------------------------------------------------------------
-
- A>sd
-
- Display the current directory of drive A.
-
- B>sd/d/6
-
- Display the current directory of drive B, sorted by descending date and
- time, using the six column format (file names only).
-
- D>sd c:\/ss/2
-
- Display only the system files in the root directory of drive C, using
- the two column output format.
-
- C>sd b:/t
-
- Display the totals information for the current directory of drive B.
-
- A>sd *.asm/b
-
- Display all files having an extension of "asm" in the current directory
- of drive A and sort the output by file size.
-
- D>sd/v/n/1/r
-
- Display volume label information and all files in the current directory
- of drive D, do not sort the file entries, use one output column, do not
- pause when the console screen fills, and allow output redirection. This
- combination of switches causes SD to behave similarly to DIR.
-
- B>sd \/s/n/2
-
- Select all files in the root directory of drive B, including those with
- the hidden and/or system attribute, do not sort the file entries, and
- display the output using the two column format.
-
- B>sd/r temp.* >c:temp.dir
-
- Select all files having a name of "temp" in the current directory of
- drive B, and redirect the console output to file "c:temp.dir".
-
- B>sd/r/1 c:\*.com >>c:temp.dir
-
- Select all files with an extension of "com" in the root directory of
- drive C, format using one output column, and redirect the console
- output, appending to the file "c:temp.dir".
-
- D>sd a:/v/p/t
-
- Display volume label information, disk parameter information, and totals
- information for the current directory of drive A.
-
- B>sd e:/m/k
-
- Display System Version and RAM information and the current directory of
- drive E, rounding the space values to kbytes.
-
- A>sd t/c/k/q
-
- Select all files in the current directory of drive A whose names begin
- with "t", clear the screen before displaying output, display file size
- and disk space values in kilobytes and do not pause the console output.
-
- C>sd \/e
-
- Display all files in the root directory of drive C sorted by file
- extension and by file name.
-
- B>sd temp
-
- If temp is an existing subdirectory in the current directory of drive B,
- then select all of the files in that directory. Otherwise, select all
- files in the current directory of drive B whose names begin with "temp".
-
- A>sd ../sar
-
- Display all files in the parent directory of the current directory of
- drive A with either the archive or read-only attribute.
-
- B>sd ..\*.a?m/a/4
-
- Display all files in the parent directory of the current directory of
- drive B whose extensions begin with "a" and end with "m" and sort the
- output by ascending date and time using the four column output format.
-
- C>sd/r/v/1 b:\dir1\dir2\dir3\*.doc/d >prn
-
- Select all files having an extension of "doc" in the directory
- "\dir1\dir2\dir3" of drive B. Sort the output by date and time. Use
- the one column output format and include volume label information.
- Redirect the console output to the printer.
-
- A>sd b:/r (Type Control-P/RETURN)
- (console output is duplicated on the printer)
- A> (Type Control-N/RETURN for Z-100, Control-P/RETURN for PC's)
-
- Display the current directory of drive B and duplicate the console
- output on the printer.
-
- ------------------------------------------------------------------------
-
- Enhancements in this Version
-
- ------------------------------------------------------------------------
-
- This version of SD.COM (5.3) contains the following enhancements,
- changes, and fixes from the previous version (5.2):
-
- Dynamic recognition of IBM-PC color and monochrome monitors.
-
- Support for user patchable foreground and background colors.
-
- DOS version number added to /m switch output.
-
- The message "No files found" is displayed if neither any files nor any
- directories match the user's request. Disk information may still be
- displayed for an empty disk by using the /t switch.
-
- A bug was fixed in the Z-100 version of SD V5.2 which could result in a
- system hang under certain conditions with MTR-100 ROM V2.5.
-
- ------------------------------------------------------------------------
-
- Additional Information
-
- ------------------------------------------------------------------------
-
- This program is in the public domain and may be freely copied as long as
- the only charge is for media and reproduction costs, etc. Under no
- conditions should the program either be sold for a profit or distributed
- in modified form without the permission of the author. If you wish to
- contact me with bug reports, suggestions for improvements, and/or
- especially large financial donations, I can be reached using the
- information provided below:
-
- John F. Stetson
- 42 Tivoli Lake Court
- Silver Spring, Md. 20906
-
- (Home) (301) 946-5615 (after 7 PM)
- (Work) (301) 340-4544
-
- Compuserve [70320,353]
- ------------------------------------------------------------------------